<html>
<head><meta charset="utf-8"><title>Why is `unsafe_derive_on_repr_packed` a query? · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Why.20is.20.60unsafe_derive_on_repr_packed.60.20a.20query.3F.html">Why is `unsafe_derive_on_repr_packed` a query?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="197852112"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Why%20is%20%60unsafe_derive_on_repr_packed%60%20a%20query%3F/near/197852112" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Why.20is.20.60unsafe_derive_on_repr_packed.60.20a.20query.3F.html#197852112">(May 17 2020 at 14:34)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/7faeae0d385730e712634fb2af331ea0140771b4/src/librustc_middle/query/mod.rs#L390-L391">https://github.com/rust-lang/rust/blob/7faeae0d385730e712634fb2af331ea0140771b4/src/librustc_middle/query/mod.rs#L390-L391</a></p>
<p>This is only called from <code>check_unsafety</code> in the same file it is declared, so this should not be necessary for the compile graph.<br>
<code>check_unsafety</code> is only called during analysis <a href="https://github.com/rust-lang/rust/blob/7faeae0d385730e712634fb2af331ea0140771b4/src/librustc_interface/passes.rs#L839-L843">https://github.com/rust-lang/rust/blob/7faeae0d385730e712634fb2af331ea0140771b4/src/librustc_interface/passes.rs#L839-L843</a></p>



<a name="197852209"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Why%20is%20%60unsafe_derive_on_repr_packed%60%20a%20query%3F/near/197852209" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Why.20is.20.60unsafe_derive_on_repr_packed.60.20a.20query.3F.html#197852209">(May 17 2020 at 14:37)</a>:</h4>
<p>THis means that <code>check_unsafety</code> should only be called exactly once for each body. As <code>unsafe_derive_on_repr_packed</code> is only called using this body id, it should both be faster and "cleaner" to use a boolean in <code>check_unsafety</code>itself to prevent duplicates if I am not missing something</p>



<a name="197852424"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Why%20is%20%60unsafe_derive_on_repr_packed%60%20a%20query%3F/near/197852424" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Why.20is.20.60unsafe_derive_on_repr_packed.60.20a.20query.3F.html#197852424">(May 17 2020 at 14:42)</a>:</h4>
<p>Will just try and implement this myself <span aria-label="sparkles" class="emoji emoji-2728" role="img" title="sparkles">:sparkles:</span> Let's see if this breaks something</p>



<a name="197852561"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Why%20is%20%60unsafe_derive_on_repr_packed%60%20a%20query%3F/near/197852561" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Why.20is.20.60unsafe_derive_on_repr_packed.60.20a.20query.3F.html#197852561">(May 17 2020 at 14:46)</a>:</h4>
<blockquote>
<p>if I am not missing something</p>
</blockquote>
<p>Aaaa, we want to warn once for each impl, not once for each method. There are builtin impls containing multiple methods.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>